import request from '@/utils/request';
import type {
  RolePageDTO,
  RoleSaveDTO,
  RoleUpdDTO,
  Page,
  Role,
  BaseResponse
} from '@/types';

// 角色分页查询
export const getRolePage = (data :RolePageDTO) => {
  return request.post<BaseResponse<Page<Role>>>('/role/page', data);
};

// 保存角色
export const saveRole = (data :RoleSaveDTO) => {
  return request.post<BaseResponse<boolean>>('/role/save', data);
};

// 更新角色
export const updateRole = (data :RoleUpdDTO) => {
  return request.post<BaseResponse<void>>('/role/update', data);
};

// 删除角色
export const deleteRole = (data :{ id :number }) => {
  return request.post<BaseResponse<void>>('/role/delete', data);
};
